import { WeaLocaleProvider } from "ecCom";
const getLabel = WeaLocaleProvider.getLabel;

export function changeQuickSearchValue(value) {
    if (this.conditionForm.isFormInit) {
        this.conditionForm.updateFields({
            taskName: { value }
        });
    }
}
export function quickSearch() {
    this.initTable();
}

export function setConditionVisible(visible) {
    this.conditionVisible = visible;
}

export function search() {
    this.initTable();
    this.setConditionVisible(false);
}

export function clearCondition() {
    this.conditionForm.resetForm()
}

export function getConditions() {
    return [{
        title: getLabel('505990', '常用条件'),
        defaultshow: true,
        items: [{
            colSpan: 2,
            conditionType: "INPUT",
            domkey: [
                "taskName"
            ],
            fieldcol: 12,
            label: getLabel('505991', '标题'),
            labelcol: 6,
            value: "",
            viewAttr: 2
        }, {
            colSpan: 2,
            conditionType: "BROWSER",
            domkey: [
                "creator"
            ],
            fieldcol: 12,
            label: getLabel('505993', '发起人'),
            labelcol: 6,
            value: "",
            viewAttr: 2,
            browserConditionParam: {
                completeParams: {},
                conditionDataParams: {},
                dataParams: {},
                destDataParams: {},
                hasAddBtn: false,
                hasAdvanceSerach: true,
                idSeparator: ",",
                isAutoComplete: 1,
                isDetail: 0,
                isMultCheckbox: false,
                isSingle: false,
                pageSize: 10,
                quickSearchName: "",
                replaceDatas: [],
                title: getLabel('505994', '人力资源'),
                type: "17",
                viewAttr: 2
            },
        }]
    }]
}

export function getQkConditions() {
    return [{
        title: getLabel('505990', '常用条件'),
        defaultshow: true,
        items: [
            {
                colSpan: 2,
                fieldcol: 12,
                labelcol: 6,
                conditionType: "SELECT",
                options: [{
                    key: "0",
                    showname: getLabel('507383', '全部'),
                    selected: true
                }, {
                    key: "1",
                    showname: getLabel('520902','进行中')
                }, {
                    key: "2",
                    showname: getLabel('520903','已完成')
                }
                ],
                domkey: [
                    'taskStaus',
                ],
                label: getLabel('520904','任务状态'),
                viewAttr: 2
            },{
                colSpan: 2,
                conditionType: "INPUT",
                domkey: [
                    "taskName"
                ],
                fieldcol: 12,
                label: getLabel('505991', '标题'),
                labelcol: 6,
                value: "",
                viewAttr: 2
            }, {
                colSpan: 2,
                conditionType: "BROWSER",
                domkey: [
                    "creator"
                ],
                fieldcol: 12,
                label: getLabel('505993', '发起人'),
                labelcol: 6,
                value: "",
                viewAttr: 2,
                browserConditionParam: {
                    completeParams: {},
                    conditionDataParams: {},
                    dataParams: {},
                    destDataParams: {},
                    hasAddBtn: false,
                    hasAdvanceSerach: true,
                    idSeparator: ",",
                    isAutoComplete: 1,
                    isDetail: 0,
                    isMultCheckbox: false,
                    isSingle: false,
                    pageSize: 10,
                    quickSearchName: "",
                    replaceDatas: [],
                    title: getLabel('505994', '人力资源'),
                    type: "17",
                    viewAttr: 2
                },
            },
            {
            colSpan: 4,
            fieldcol: 12,
            labelcol: 6,
            conditionType: "SELECT_LINKAGE",
            selectLinkageDatas: {
                "6": {
                    conditionType: "RANGEPICKER",
                    domkey: [
                        "taskstart",
                        "taskend"
                    ]
                }
            },
            options: [{
                key: "0",
                showname: getLabel('507383', '全部'),
                selected: true
            }, {
                key: "1",
                showname: getLabel('505995', '今天')
            }, {
                key: "2",
                showname: getLabel('505996', '本周')
            }, {
                key: "3",
                showname: getLabel('505997', '本月')
            }, {
                key: "5",
                showname: getLabel('506002', '本年')
            }, {
                key: "7",
                showname: getLabel('505998', '上个月')
            }, {
                key: "8",
                showname: getLabel('505999', '上一年')
            }, {
                key: "6",
                showname: getLabel('506000', '指定日期范围')
            }
            ],
            domkey: [
                "taskDate",
                "createDate"
            ],
            label: getLabel('520901','发起时间'),
            viewAttr: 3
        }
        ]
    }]
}